package hu.stud.uszeged.inf.prf.prftrac.entity;

import hu.stud.uszeged.inf.prf.prftrac.session.enums.Priority;
import hu.stud.uszeged.inf.prf.prftrac.session.enums.TicketState;
import hu.stud.uszeged.inf.prf.prftrac.session.enums.TicketType;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.validator.NotNull;

@Entity
public class Ticket implements Serializable
{	
	private static final long serialVersionUID = -8513228688238026748L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;
	private String name;
	@Enumerated(EnumType.STRING)
	@NotNull
	private TicketType type;
	private String description;
	@ManyToOne
	@Fetch(FetchMode.JOIN)
	private User user;
	private Date deadline;
	private Priority priority;
	@ManyToOne
	@Fetch(FetchMode.JOIN)
	private Milestone milestone;
	private TicketState state;
	
	public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public TicketType getType() {
		return type;
	}
	
	public void setType(TicketType type) {
		this.type = type;
	}
	
	public void setDescription(String description) {
		this.description = description;
	}

	public String getDescription() {
		return description;
	}

	public User getUser() {
		return user;
	}
	
	public void setUser(User user) {
		this.user = user;
	}
	
	public Date getDeadline() {
		return deadline;
	}
	
	public void setDeadline(Date deadline) {
		this.deadline = deadline;
	}
	
	public Priority getPriority() {
		return priority;
	}
	
	public void setPriority(Priority priority) {
		this.priority = priority;
	}
	
	public Milestone getMilestone() {
		return milestone;
	}
	
	public void setMilestone(Milestone milestone) {
		this.milestone = milestone;
	}

	public void setState(TicketState state) {
		this.state = state;
	}

	public TicketState getState() {
		return state;
	}
}
